
import { Injectable } from '@angular/core';
import { CommandHandler, NgCommandHandler, CommandContext } from '@farris/devkit';

import { TreeDataService as TreeDataService1 } from '@farris/command-services';
import { CommandService as CommandService1 } from '@farris/command-services';

@Injectable()
@NgCommandHandler({
    commandName: 'treegridcomponentviewmodelloadFullTree2'
})
export class treegridcomponentviewmodelloadFullTree2Handler extends CommandHandler {
    constructor(
        public _TreeDataService1: TreeDataService1,
        public _CommandService1: CommandService1
    ) {
        super();
    }

    schedule() {
        this.addTask('suspendFrameContextRowSelectedEvent', (context: CommandContext) => {
            const args = [];
            return this.invoke(this._CommandService1, 'suspendFrameContextRowSelectedEvent', args, context);
        });

        this.addTask('loadFullTree', (context: CommandContext) => {
            const args = [
                '{COMMAND~/params/virtualPropertyName}', 
                '{COMMAND~/params/fullTreeType}', 
                '{COMMAND~/params/loadType}', 
                '{COMMAND~/params/filters}', 
                '{COMMAND~/params/frozenCurrentRow}'
                    ];
            return this.invoke(this._TreeDataService1, 'loadFullTree', args, context);
        });

        this.addTask('resumeFrameContextRowSelectedEvent', (context: CommandContext) => {
            const args = [];
            return this.invoke(this._CommandService1, 'resumeFrameContextRowSelectedEvent', args, context);
        });

        this.addTask('setCurrentId', (context: CommandContext) => {
            const args = [
                '{COMMAND~/params/currentId}'
                    ];
            return this.invoke(this._TreeDataService1, 'setCurrentId', args, context);
        });

        this.addLink('suspendFrameContextRowSelectedEvent', 'loadFullTree', `1==1`);
        this.addLink('loadFullTree', 'resumeFrameContextRowSelectedEvent', `1==1`);
        this.addLink('resumeFrameContextRowSelectedEvent', 'setCurrentId', `1==1`);
    }
}